package com.bling.common.util;

/**
 * 密码加密工具
 * @author BLingSoft
 *
 */
public class PasswordEncryption {

	private final static char[] chs = {'A','B','C','D','E','F','G','H','I','J'}; 
	private final static char[] nums = {'j','i','h','g','f','e','d','c','b','a'};
	
	public synchronized static String getPassword(String password){
		StringBuffer temp = new StringBuffer();
		StringBuffer pass = new StringBuffer();
		int length = 0;
		if(null==password||password.length()<1)
			return null;
		byte[] bytes = password.getBytes();
		for(byte b : bytes)
			temp.append(b);
		length = temp.length();
		for(int i=0;i<length;i++){
			String a = String.valueOf(temp.charAt(i));
			int b = Integer.parseInt(a);
			if(b%2==0)
				pass.append(chs[b]);
			else
				pass.append(nums[b]);
		}
		return pass.toString();
	}
}
